<%@ page language="Java" import="java.util.*,descriptor.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<%
	String login = (String)request.getSession().getAttribute("login");
	String mail = (String)request.getSession().getAttribute("mail");
	String msg = (String)request.getAttribute("msg");
	String msg2 = (String)request.getAttribute("msg2");
	String error1 = (String)request.getAttribute("error1");
	String error2 = (String)request.getAttribute("error2");
	String error3 = (String)request.getAttribute("error3");
%>

<%	
	String style_mail = "style=\"display: none\"";
	String style_pass = "style=\"display: none\"";
	String email = "";
	String notif_mail_ok = "";
	String notif_mail_error = "";
	String notif_pass_ok = "";
	String notif_pass_error = "";
	
	if(error1 != null)
	{
		style_mail = "style=\"display: block\"";
		email = error2;
		notif_mail_error = "<p style=\"color:red; font-size: 10px;\">" + error1 + "<p>";
	}	
	
	if(error3 != null)
	{
		style_pass = "style=\"display: block\"";
		notif_pass_error = "<p style=\"color:red; font-size: 10px;\">" + error3 + "<p>";
	}
	
	if(msg != null)
	{
		notif_mail_ok = "<p style=\"color:red; font-size: 10px;\">" + msg + "<p>";
	}
	
	if(msg2 != null)
	{
		notif_pass_ok = "<p style=\"color:red; font-size: 10px;\">" + msg2 + "<p>";
	}
%>

<html>
	<jsp:include page="CareerHeader.jsp" >
		<jsp:param name="pageTitle" value="Work Placement Management System - Career Officer" />
	</jsp:include>
	<body OnLoad="showmenu(document.getElementById('smenu1'));">
		<jsp:include page="CareerPageHeader.jsp"></jsp:include>
		<div id="container">
			<jsp:include page="CareerMenu.jsp" ></jsp:include>
			<div id="content">
				<h3 class="posttitle">Career Officer - Settings</h3>
				<div class="entry">
					<div>
						<fieldset>
							<legend> User Identification </legend>
							<p> User Login ID : <input type="text" name="uid" value="<%= login %>" disabled> </p>
						</fieldset>
						<form method="post">
							<fieldset>
								<legend> Email </legend>
								<p> Email : <input type="text" name="email" value="<%= mail %>" disabled> <input id="btn" type="button" OnClick="showElt('changeEmail')" name="btnChange" value="Change"></p>
								<%= notif_mail_ok %>
								<div id="changeEmail" class="changeEmail" <%= style_mail %>>
									<fieldset>
										<input type="hidden" name="action" value="changeMail">
										<legend> Change your Email </legend>
										<p>Type the New Email Address : <input type="text" name="email" value="<%= email %>"><%= notif_mail_error %><p>
										<p><button type="submit">Ok</button> <input id="btn" type="button" OnClick="HideElt('changeEmail')" name="btnDiscardEmail" value="Don't Change"> <button type="reset">Clear</button></p>
									</fieldset>
								</div>
							</fieldset>
						</form>
						<form method="post">
							<fieldset>
								<legend> Password </legend>
								<p> Password  <input id="btn" type="button" OnClick="showElt('changePasswd')" name="btnChange" value="Change"></p>
								<%= notif_pass_ok %>
								<div id="changePasswd" class="newPasswd" <%= style_pass %>>
									<fieldset>
										<input type="hidden" name="action" value="changePasswd">
										<legend> Change your Password </legend>
										<p>Type the Old Password : <input type="password" name="Oldpasswd" value=""><p>
										<p>Type the New Password : <input type="password" name="Newpasswd1" value=""><p>
										<p>Re-Type the New Password : <input type="password" name="Newpasswd2" value=""><p>
										<%= notif_pass_error %>
										<p><button type="submit">Ok</button> <input id="btn" type="button" OnClick="HideElt('changePasswd')" name="btnDiscardPasswd" value="Don't Change"> <button type="reset">Clear</button></p>
									</fieldset>
								</div>
							</fieldset>
						</form>
					</div>	
				</div>
	    	</div>
			<jsp:include page="CareerPageFooter.jsp"></jsp:include>
		</div>
	</body>
</html>